/*
 * Instruction08.java
 *
 * Created on March 21, 2007, 9:55 PM
 * 
 */
/*
 
Add one to index register X. LEAX 1,X can produce the same result but
LEAX does not affect the Z status bit. Although the LEAX instruction is
more flexible, INX requires only one byte of object code.
INX operation affects only the Z status bit.

 */
package moto9s12sim;

/*
 *
 * @author Fergus Earnshaw
 *
 */
public class Instruction08 extends Instruction {
    
    /** Creates a new instance of Instruction08 */
    public Instruction08()
    {
        this.strAssemblyCode = "INX";
        this.bCodes = new byte[1];
        this.bCodes[0] = (byte)Integer.parseInt("08",16);
    }
    
    public boolean excute(M9S12 cpu)
    {
        this.shAddr = cpu.PC.getRegister();
        cpu.PC.inc();
        
        //(X) + $0001 => X
        
        cpu.X.inc();

        
        cpu.CC.setZ(cpu.X.getRegister() == 0);
        
        printInstruction(cpu);
        return true;
    }  
    
}
